import Vue from 'vue'
import Router from 'vue-router'
import App from '../App'
import Index from '@/components/index'
import Book from '@/components/Book'
import BookAdd from '@/components/BookAdd'
import BookUpdate from '@/components/BookUpdate'
import Writer from '@/components/Writer'
import Writer2 from '@/components/Writer2'

Vue.use(Router)

export default new Router({
  routes: [
    {
      path: '/',
      name: '图书管理',
      component: Index,
      redirect: '/book',
      children: [
        {
          path: '/book',
          name: '查询图书',
          component: Book,
          show: true
        },
        {
          path: '/addbook',
          name: '添加图书',
          component: BookAdd,
          show: true
        },
        {
          path: '/updatebook',
          name: '更新图书',
          component: BookUpdate,
          show: false
        }
      ]
    },
    {
      path: '/navigation',
      name: '作者管理',
      component: Index,
      children: [
        {
          path: '/writer',
          name: '查询作者',
          component: Writer,
          show: false
        },
        {
          path: '/writer2',
          name: '修改作者',
          component: Writer2,
          show: false
        }
      ]
    }
  ]
})
